﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IDal
{
   public static class Common
    { 
        public static IQueryable<Product> WhereNotDeleted(this  IQueryable<Product> products)
        {
            return products.Where(p => p.IsDelete == false);
        }


        public static void Require<T>(this T tSource, Func<T, string> func, string exptionMsg)
        {
            if (string.IsNullOrEmpty(func(tSource)))
            {
                throw new Exception(exptionMsg);
            }
        } 
    }


}
